home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / global / minefield.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  2.9 KB  |  105 lines

  1. //*********************************************************************************************************************************************
  2. //*** minefield script
  3. //*** The player enters the minefield, and within a short random amount of time
  4. //*** if he's still in the minefield he'll blow himself up and crush his skull.
  5. //*** This main thread is called by this script and should not be called by the
  6. //*** level script itsself.  The level script should call minefield_setup
  7. //*** syntax ------------------------------------
  8. //*** minefield <this is the index number for the array of minefield triggers>
  9. //*********************************************************************************************************************************************
  10. minefield local.index:
  11.  
  12. minefield_loop:
  13. $minefield[local.index] waittill trigger
  14.  
  15. local.sucker = parm.other
  16. local.sucker playsound mine_trigger
  17.  
  18. wait (randomfloat .5 + .5)
  19.  
  20. if (local.sucker istouching $minefield[local.index] == 1)
  21. {
  22.     local.spawn_mine = (local.sucker.targetname + "_mine")
  23.     if ($minefield[local.index].type == "water")
  24.         {
  25.             spawn animate/fx_mortar_water targetname local.spawn_mine
  26.  
  27.             local.spawn_mine = $(local.sucker.targetname + "_mine")
  28.             local.spawn_mine.origin = local.sucker.origin
  29.             
  30.             local.spawn_mine anim start
  31.             local.spawn_mine playsound grenade_exp_water
  32.             //$player exec global/bullethit.scr (0 -1 0) 1000 50 1
  33.             radiusdamage local.spawn_mine.origin 4000 256
  34.         }
  35.     else
  36.     {
  37.         spawn animate/fx_explosion_mine targetname local.spawn_mine
  38.  
  39.             local.spawn_mine = $(local.sucker.targetname + "_mine")
  40.             local.spawn_mine.origin = local.sucker.origin
  41.             
  42.             local.spawn_mine anim start
  43.             //$player exec global/bullethit.scr (0 -1 0) 1000 50 1
  44.             radiusdamage local.spawn_mine.origin 4000 256
  45.     }
  46.     
  47.     //*** remove the effect
  48.     wait 3
  49.     local.spawn_mine remove
  50. }
  51.  
  52. goto minefield_loop
  53.  
  54. end
  55.  
  56.  
  57. //**************************************
  58. //*** single version minefield thread
  59. minefield_single:
  60. $minefield waittill trigger
  61.  
  62. wait (randomfloat .5 + .5)
  63.  
  64. if ($player istouching $minefield == 1)
  65. {
  66.     spawn animate/fx_explosion_mine targetname player_mine_of_doom
  67.     $player_mine_of_doom.origin = $player.origin
  68.     
  69.     $player_mine_of_doom anim start
  70.     $player exec global/bullethit.scr (0 -1 0) 1000 50 1
  71. }
  72. else
  73. {
  74.     goto minefield_single
  75. }
  76.  
  77. end
  78.  
  79.  
  80. //*************************************************
  81. //*** setup the minefields
  82. //*** the level scripts should call this thread
  83. //*************************************************
  84. minefield_setup:
  85. if ($minefield == NULL)
  86. {
  87.     println "^~^~^ There are no minefields in the map!!!"
  88.     goto minefield_setup_end
  89. }
  90.  
  91. /*
  92. if ($minefield.size == 1)
  93. {
  94.     thread minefield_single
  95.     goto minefield_setup_end
  96. }
  97. */
  98.  
  99. for (local.i = 1 ; local.i <= $minefield.size ; local.i ++)
  100. {
  101.     thread minefield local.i
  102. }
  103.  
  104. minefield_setup_end:
  105. end